package kibahed.university.effizientealgorithmen.standardclasses;

public class CostLine implements Comparable<CostLine>{
	
	private double[] line;
	private int vertex;

	public CostLine(double[] line, int vertex){
		this.line=line;
		this.vertex=vertex;
	}

	public double[] getLine() {
		return line;
	}

	public void setLine(double[] line) {
		this.line = line;
	}

	public int getVertex() {
		return vertex;
	}

	public void setVertex(int vertex) {
		this.vertex = vertex;
	}

	@Override
	public int compareTo(CostLine otherLine) {
		double sum = 0;
		for(double d:line){
			sum+=d;
		}
		double sum2 =0;
		for(double d:otherLine.getLine()){
			sum2+=d;
			if(sum2>sum){
				return 1;
			}
		}
		if(sum>sum2){
			return -1;
		}
		return 0;
	}
}
